package backproped;

public class ContinuousPerceptron {

	private double[] weightings;
	private double learningRate;
	
	public ContinuousPerceptron(double[] w, double c) {
		weightings = w;
		learningRate = c;
	}
		
	//size of input == size of weightings 
	public double calcOutput(double[] y) {
		//using the bipolar activation function
		// (1 - e^-v)/(1+e^-v)
		// v = input' * weightings 
		double sum = 0.00;
		int j = 0;
		for (double i : y) {
			sum += i * weightings[j];
			j++;
		}
		//System.out.println("Sum= "+sum+" Output= "+(1 - Math.exp(-sum)) / (1 + Math.exp(-sum)));
		return (1 - Math.exp(-sum)) / (1 + Math.exp(-sum));
	}
	
	public void setWeights(double[] w) {
		weightings = w;
	}
	
	public double[] getWeightings() {
		return weightings;
	}

}
